﻿//修改信息
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "hrEmployee";
    var deptId = record.getData("DeptID");
    var deptName = record.getData("DeptName");
    var postName = record.getData("PostName");
    var pagetitle = "修改在职员工信息—" + record.getData("CName");
    parent._employeeTitle = pagetitle;

    parent.addTabs(pagetitle, encodeURI("../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID) + "&deptId=" + deptId + "&deptName=" + deptName + "&postName=" + postName + "&type=1"));
    parent.NeedRefreshPage = this;
}



//附属信息
var fnFuShuXinXi = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    //获取功能ID
    var url = encodeURI("../Extend/AjaxData/jsonlist.aspx?entity=SysFunction&condition=Name='附属信息'");
    $.get(url, function (d, s) {
        var list = eval("(" + d + ")");
        if (list.total > 0) {
            for (var o in list.rows) {
                var functionId = list.rows[o].FunctionId;
                if (typeof (functionId) != "undefined") {
                    var pagetitle = "员工档案信息—" + record.getData("CName");
                    parent.addTabs(pagetitle, "../EHR/onetomore.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID) + "&functionid=" + functionId);
                    parent.NeedRefreshPage = this;
                    break;
                }
            }
        }
    });
}

var fnCustomReport = function () {
    
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    const_EditEntity = "hrEmployee";
    var deptId = record.getData("DeptID");
    var deptName = record.getData("DeptName");
    var postName = record.getData("PostName");
    var pagetitle = "员工报表—" + record.getData("CName");
    parent._employeeTitle = pagetitle;

    parent.addTabs(pagetitle, encodeURI("../Rpt/Rpt_hr_employee.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID) + "&deptId=" + deptId + "&deptName=" + deptName + "&postName=" + postName + "&type=1"));
    parent.NeedRefreshPage = this;


}
